<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Dingo.radioInterface.VirtualRadio</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Dingo-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/dingo-wsn/">Dingo</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Dingo-module.html">Package&nbsp;Dingo</a> ::
        <a href="Dingo.radioInterface-module.html">Module&nbsp;radioInterface</a> ::
        Class&nbsp;VirtualRadio
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Dingo.radioInterface.VirtualRadio-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class VirtualRadio</h1><br /><br />
<center>
<center>  <map id="uml_class_diagram_for_dingo_ra_3" name="uml_class_diagram_for_dingo_ra_3">
<area shape="rect" href="Dingo.radioInterface.RadioInterface&#45;class.html#radioSend" title="Send an individual packet." alt="" coords="124,36,311,55"/>
<area shape="rect" href="Dingo.radioInterface.RadioInterface&#45;class.html" title="Interface to a real or simulated radio." alt="" coords="123,11,312,56"/>
<area shape="rect" href="Dingo.radioInterface.VirtualRadio&#45;class.html#reachable_sensors" title="Returns a list of all sensor ids within a given radius." alt="" coords="17,111,417,130"/>
<area shape="rect" href="Dingo.radioInterface.VirtualRadio&#45;class.html#send" title="Send a message to a single sensor." alt="" coords="17,130,417,148"/>
<area shape="rect" href="Dingo.radioInterface.VirtualRadio&#45;class.html#broadcast" title="Broadcast a message to sensors within radius, excluding sender." alt="" coords="17,148,417,167"/>
<area shape="rect" href="Dingo.radioInterface.VirtualRadio&#45;class.html#multicast" title="Multicast a message to the specified sensors." alt="" coords="17,167,417,186"/>
<area shape="rect" href="Dingo.radioInterface.VirtualRadio&#45;class.html#get_sensor" title="Return a sensor within the simulation" alt="" coords="17,186,417,204"/>
<area shape="rect" href="Dingo.radioInterface.VirtualRadio&#45;class.html#__init__" title="Initialise a new Ether object." alt="" coords="17,204,417,223"/>
<area shape="rect" href="Dingo.radioInterface.VirtualRadio&#45;class.html" title="Class to model radio transmission." alt="" coords="16,86,419,224"/>
</map>
  <img src="uml_class_diagram_for_dingo_ra_3.gif" alt='' usemap="#uml_class_diagram_for_dingo_ra_3" ismap="ismap" class="graph-without-title" />
</center></center>
<hr />
<p>Class to model radio transmission.</p>
  TODO: Should get physical data from radio propagation model.<br /><br />

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Dingo.radioInterface.VirtualRadio-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">sim</span>,
        <span class="summary-sig-arg">rf_ranger</span>)</span><br />
      Initialise a new Ether object.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">Dingo.sensor.Sensor</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="get_sensor"></a><span class="summary-sig-name">get_sensor</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">sensor_id</span>)</span><br />
      Return a sensor within the simulation</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Dingo.radioInterface.VirtualRadio-class.html#send" class="summary-sig-name">send</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">msg</span>,
        <span class="summary-sig-arg">arc_colour</span>)</span><br />
      Send a message to a single sensor.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Dingo.radioInterface.VirtualRadio-class.html#broadcast" class="summary-sig-name">broadcast</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">sender_id</span>,
        <span class="summary-sig-arg">arc_colour</span>,
        <span class="summary-sig-arg">time_sent</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">msg</span>=<span class="summary-sig-default">None</span>)</span><br />
      Broadcast a message to sensors within radius, excluding 
      sender.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Dingo.radioInterface.VirtualRadio-class.html#multicast" class="summary-sig-name">multicast</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">sender_id</span>,
        <span class="summary-sig-arg">arc_colour</span>,
        <span class="summary-sig-arg">time_sent</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">msg</span>=<span class="summary-sig-default">None</span>)</span><br />
      Multicast a message to the specified sensors.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">list</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Dingo.radioInterface.VirtualRadio-class.html#reachable_sensors" class="summary-sig-name">reachable_sensors</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">sensor_id</span>)</span><br />
      Returns a list of all sensor ids within a given radius.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Dingo.radioInterface.VirtualRadio-class.html#__send" class="summary-sig-name">__send</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">msg</span>,
        <span class="summary-sig-arg">sender_id</span>,
        <span class="summary-sig-arg">recv_id</span>)</span><br />
      Special send function for broadcasting.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">float</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__dist"></a><span class="summary-sig-name">__dist</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">(x1, y1)</span>,
        <span class="summary-sig-arg">(x2, y2)</span>)</span><br />
      Determine the 2D distance between two nodes.</td>
          <td align="right" valign="top">
            
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="Dingo.radioInterface.RadioInterface-class.html">RadioInterface</a></code></b>:
      <code><a href="Dingo.radioInterface.RadioInterface-class.html#radioSend">radioSend</a></code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__getattribute__</code>,
      <code>__hash__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__repr__</code>,
      <code>__setattr__</code>,
      <code>__str__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">sim</span>,
        <span class="sig-arg">rf_ranger</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </table>
  
  Initialise a new Ether object.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>sim</code></strong> (Dingo.simulation.Simulation) - The simulation the ether is attached to</li>
        <li><strong class="pname"><code>rf_ranger</code></strong> (Dingo.ranger.RFRanger) - The ranger used by the (simulated) transmission medium</li>
    </ul></dd>
    <dt>Overrides:
      <a href="Dingo.radioInterface.RadioInterface-class.html#__init__">RadioInterface.__init__</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="send"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">send</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">msg</span>,
        <span class="sig-arg">arc_colour</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </table>
  
  <p>Send a message to a single sensor.</p>
  <p>This places a message on the receive Queue of a given sensor.</p>
  If a sensor tries to send to an unreachable peer a message is placed 
  in the panel of the debug plugin to log the attempt.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>msg</code></strong> (Dingo.packet.Packet) - The message to send</li>
        <li><strong class="pname"><code>arc_colour</code></strong> (Dingo.OGL.SensorColour) - The colour of the transmission arc shown on the graph</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="broadcast"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">broadcast</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">sender_id</span>,
        <span class="sig-arg">arc_colour</span>,
        <span class="sig-arg">time_sent</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">msg</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </table>
  
  Broadcast a message to sensors within radius, excluding sender. 
  Broadcast radius is set in api.Ether.RF_radius. If no message is passed 
  to broadcast it tries to find one on the send_q of the sending sensor. If
  that queue is empty broadcast returns. Messages that are sent are shallow
  copies of the original message.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>sender_id</code></strong> (str) - The ID of the sending sensor</li>
        <li><strong class="pname"><code>arc_colour</code></strong> (Dingo.OGL.SensorColour) - The colour the message arcs are on the sensorGraph object</li>
        <li><strong class="pname"><code>time_sent</code></strong> (float) - Time the message was sent</li>
        <li><strong class="pname"><code>msg</code></strong> (Dingo.packet.Packet) - The message to transmit.</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="multicast"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">multicast</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">sender_id</span>,
        <span class="sig-arg">arc_colour</span>,
        <span class="sig-arg">time_sent</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">msg</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </table>
  
  <p>Multicast a message to the specified sensors.</p>
  <p>Multicast allows the user to send a message to a list of specified 
  sensors, providing these sensors are within the range defined in the 
  Ether.</p>
  <p>The list of sensors to send the message to is derived from the msg 
  packets receiver_id field. This should be a list or tuple containing the 
  intended receivers ID's</p>
  <p>As per Broadcast messages are if no message is specified a check is 
  made to the Queue. Messages that are sent are shallow copies of the 
  original message.</p>
  Contributed by Daniel Goldsmith.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>sender_id</code></strong> (str) - The ID of the sending sensor</li>
        <li><strong class="pname"><code>arc_colour</code></strong> (Dingo.OGL.SensorColour) - The colour the message arcs are on the sensorGraph object</li>
        <li><strong class="pname"><code>time_sent</code></strong> (float) - Time the message was sent</li>
        <li><strong class="pname"><code>msg</code></strong> (Dingo.packet.Packet) - The message to transmit</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="reachable_sensors"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">reachable_sensors</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">sensor_id</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </table>
  
  Returns a list of all sensor ids within a given radius. This checks 
  for all sensors that are within transmission range of a given node.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>sensor_id</code></strong> (str) - The sensor we wish to have at the centre of our range 
          calculations</li>
    </ul></dd>
    <dt>Returns: list</dt>
  </dl>
</td></tr></table>
</div>
<a name="__send"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__send</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">msg</span>,
        <span class="sig-arg">sender_id</span>,
        <span class="sig-arg">recv_id</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    >&nbsp;
    </td>
  </table>
  
  Special send function for broadcasting. Reachability should be checked
  by the calling function.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>msg</code></strong> (Dingo.packet.Packet) - The message to transmit</li>
        <li><strong class="pname"><code>sender_id</code></strong> (str) - The ID of the sending sensor</li>
        <li><strong class="pname"><code>time_sent</code></strong> (float) - Time the message was sent</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Dingo-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/dingo-wsn/">Dingo</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    <a href="epydoc-log.html">Generated by Epydoc
    3.0beta1 on Tue Jun  3 00:42:57 2008</a>
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
